import 'package:flutter/material.dart';
import 'package:aweb5/base/BaseWidget.dart';

import 'package:flutter/cupertino.dart';
import 'dart:async';
class StartPageWidget extends BaseWidget {
  String imgUrl;
  Widget navitoWidget;
   int time;
  StartPageWidget(this.imgUrl,this.navitoWidget,this.time);
  @override
  State<StartPageWidget> createState() => StartPageWidgetState();
}

class StartPageWidgetState extends BaseWidgetState<StartPageWidget> {
  var timer;

  @override
  void initState() {

    super.initState();
    timer = new Timer( Duration(milliseconds: widget.time), () {
      try {
        Navigator.of(context).pushAndRemoveUntil(new MaterialPageRoute(
            builder: (BuildContext context) => widget.navitoWidget), (//跳转到主页
            Route route) => route == null);
      } catch (e) {

      }
    });
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: new Container(
            width: MediaQuery.of(context).size.width,
            height: MediaQuery.of(context).size.height,
            color: Color.fromRGBO(0, 0, 0, 0),
            child: Image.asset(widget.imgUrl,fit: BoxFit.fill,)



        ));
  }
}